package cn.jbit.service;

import cn.jbit.mapper.OrderMapper;
import cn.jbit.pojo.Order;
import cn.jbit.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderMapper orderDao;

    @Override
    public Result selectOrderByOrderId(Integer orderId){
        //判断订单号是否为空
        if (orderId==null){
            log.info("您的订单号为空");
            return null;
        }

        Order order=orderDao.selectOrderByOrderId(orderId);
        //判断订单号多对应的订单是否存在
        if (order==null){
            log.info("您查找的订单不存在...");
            return new Result(400,"您查找的订单不存在");
        }

        System.out.println("订单详情："+order);
        return new Result(200,"SUCCESS",order);
    }
}
